package main

import (
	"log"
	"math/rand"
)

/**
recover 捕获  panic 抛出的错误信息
*/
func main() {
	defer func() {
		if r := recover(); r != nil {
			log.Fatal(r)
		}
	}()
	for {
		i := rand.Intn(5)
		log.Println("i:", i)
		if i == 0 {
			panic("i is Zero")
			break
		}
	}

}
